package dish_order;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.*;
import java.util.ArrayList;

import javax.swing.*;
public class MainView{	
	JFrame frame = new JFrame();
	DishView dv = new DishView("�Ȳ�ҳ");
	public MainView(String title){
		frame.setTitle(title);
		frame.setSize(1100, 700);
	}
	public void SetViewer(){
		final JButton button = new JButton("������");
		frame.setSize(1100,700);
		frame.setLayout(new FlowLayout(FlowLayout.CENTER,1,1));
		JPanel panel = new JPanel();
		ImageIcon ic = new ImageIcon("D:\\head first pics\\5.jpg");
		JLabel label=new JLabel();
		JLabel label2 = new JLabel("��ӭ����kaiser's����");
		label2.setFont(new Font("Dialog",1,32));
		label.setIcon(ic);
		panel.add(label);
		panel.add(button);
		button.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				if(e.getSource() == button){
					dv.SetViewer(0,new ArrayList<String>());
					frame.setVisible(false);
				}
			}
		});
		frame.setContentPane(panel);
		frame.setVisible(true);
		frame.add(label2);
		frame.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent arg){
				System.exit(1) ;
			}
		}) ;
	}
	public void SetFinishViewer(int sum){
		final JButton button = new JButton("我的菜单");
		frame.setSize(1100,700);
		frame.setLayout(new FlowLayout(FlowLayout.CENTER,1,1));
		JPanel panel = new JPanel();
		ImageIcon ic = new ImageIcon("D:\\head first pics\\����.jpg");
		JLabel label=new JLabel();
		JLabel label2=new JLabel();
		label2.setText("��ϲ���˳ɹ����ܼۣ�"+sum+"Ԫ��");
		label2.setFont(new Font("Dialog",1,44));
		label2.setForeground(Color.red);
		label.setIcon(ic);
		panel.add(label);
		panel.add(label2);
		panel.add(button);
		button.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				if(e.getSource() == button){
					dv.SetViewer(0,new ArrayList<String>());
					frame.setVisible(false);
				}
			}
		});
		frame.setContentPane(panel);
		frame.setVisible(true);
		frame.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent arg){
				System.exit(1) ;
			}
		}) ;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		MainView mv = new MainView("��ӭ����Kaiser's����");
		mv.SetViewer();
	}
}

